import nest.bb.spike.*;

class BootStrap {

    def init = { servletContext ->
		
		
		Person person = new Person(firstName: "personFirst", lastName: "personLast").save(flush: true);

		EmergencyContact emergencyContact = new EmergencyContact(
				firstName: "emergencyFirstName",
				lastName: "emergencyLastName",
				mainContact: false
				)
		Phone phone = new Phone(
				phoneType: PhoneTypeEnum.HOME,
				phone: "911"
				)
		emergencyContact.addToPhones(phone)
		emergencyContact.addToPhones(phone)
		person.addToEmergencyContacts(emergencyContact)

		EmergencyContact emergencyContact2 = new EmergencyContact(
				firstName: "emergency2FirstName",
				lastName: "emergency2LastName",
				mainContact: true
				)
		Phone phone2 = new Phone(
				phoneType: PhoneTypeEnum.MOBILE,
				phone: "119"
				)
		Phone phone3 = new Phone(
				phoneType: PhoneTypeEnum.WORK,
				phone: "319"
				)
		emergencyContact2.addToPhones(phone2)
		emergencyContact2.addToPhones(phone3)
		person.addToEmergencyContacts(emergencyContact2)
		
		
    }
    def destroy = {
    }
}
